package com.dlc.shop.allinpay.service.impl;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.dlc.shop.allinpay.OpenClient;
import com.dlc.shop.allinpay.config.AllinpayConfig;
import com.dlc.shop.allinpay.service.AllinpayCompanyService;
import com.dlc.shop.allinpay.service.AllinpayMemberService;
import com.dlc.shop.bean.dto.allinpay.*;
import com.dlc.shop.bean.model.ShopBankCard;
import com.dlc.shop.bean.vo.ShopBankCardVO;
import com.dlc.shop.common.allinpay.constant.*;
import com.dlc.shop.common.allinpay.member.constant.IdentityType;
import com.dlc.shop.common.allinpay.member.constant.MemberType;
import com.dlc.shop.common.allinpay.member.constant.VerificationCodeType;
import com.dlc.shop.common.allinpay.member.constant.VisitSourceType;
import com.dlc.shop.common.allinpay.member.req.*;
import com.dlc.shop.common.allinpay.member.resp.*;
import com.dlc.shop.common.bean.PaySettlementConfig;
import com.dlc.shop.common.config.Constant;
import com.dlc.shop.common.constants.CacheNames;
import com.dlc.shop.common.constants.SegmentIdKey;
import com.dlc.shop.common.enums.StatusEnum;
import com.dlc.shop.common.exception.YamiShopBindException;
import com.dlc.shop.common.util.Json;
import com.dlc.shop.common.util.RedisUtil;
import com.dlc.shop.config.ShopConfig;
import com.dlc.shop.dao.ShopBankCardMapper;
import com.dlc.shop.dao.ShopDetailMapper;
import com.dlc.shop.service.SegmentService;
import com.dlc.shop.service.SysConfigService;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;
import java.util.Objects;

/**
 * @author TRACK
 */
@Service
@AllArgsConstructor
public class AllinpayCompanyServiceImpl implements AllinpayCompanyService {
    private static final Logger logger = LoggerFactory.getLogger(AllinpayCompanyService.class);

    private final ShopDetailMapper shopDetailMapper;
    private final AllinpayMemberService allinpayMemberService;
    private final AllinpayConfig allinpayConfig;
    private final SegmentService segmentService;
    private final ShopBankCardMapper shopBankCardMapper;
    private final SysConfigService sysConfigService;
    private final ShopConfig shopConfig;

    @Override
    public void createCompanyMember(String bizUserId) {
        CreateMember createMember = new CreateMember(bizUserId);
        createMember.setMemberType(MemberType.ENTERPRISE.value());
        createMember.setSource(VisitSourceType.PC.value());
        allinpayMemberService.createMember(createMember);
    }

    @Override
    @Cacheable(cacheNames = CacheNames.COMPANY_INFO, key = "#tenantId")
    public CompanyInfo getCompanyInfo(String tenantId) {
        GetMemberInfo getMemberInfo = new GetMemberInfo(tenantId);
        CompanyInfo companyInfo = allinpayMemberService.getCompanyInfo(getMemberInfo);
        // 解密
        OpenClient client = allinpayConfig.getClient();
        companyInfo.setLegalIds(Objects.isNull(companyInfo.getLegalIds()) ? null : client.decrypt(companyInfo.getLegalIds()));
        companyInfo.setAccountNo(Objects.isNull(companyInfo.getAccountNo()) ? null : client.encrypt(companyInfo.getAccountNo()));
        return companyInfo;
    }

    @Override
    public void sendVerificationCode(String bizUserId, VerificationCodeDTO verificationCodeDTO) {
        SendVerificationCode svc = new SendVerificationCode(bizUserId, verificationCodeDTO.getPhone());
        Integer type = verificationCodeDTO.getVerificationCodeType();
        if (type != null
                && VerificationCodeType.instance(type) != null) {
            svc.setVerificationCodeType(type);
        }
        allinpayMemberService.sendVerificationCode(svc);
    }

    @Override
    @CacheEvict(cacheNames = CacheNames.SHOP_DETAIL_ID_KEY, key = "#shopId")
    public void bindPhone(Long shopId, VerificationCodeDTO verificationCodeDTO) {
        String bizUserId = AllinpayConstant.SHOP + shopId;
        BindPhone bindPhone = new BindPhone(bizUserId, verificationCodeDTO.getPhone(), verificationCodeDTO.getVerificationCode());
        allinpayMemberService.bindPhone(bindPhone);
        // 更新绑定手机号码状态
        shopDetailMapper.updateShopBindPhone(Long.valueOf(bizUserId.substring(AllinpayConstant.SHOP_LENGTH)), 1);
    }

    @Override
    @CacheEvict(cacheNames = CacheNames.SHOP_DETAIL_ID_KEY, key = "#shopId")
    public void unbindPhone(Long shopId, VerificationCodeDTO verificationCodeDTO) {
        UnbindPhone unbindPhone = new UnbindPhone(AllinpayConstant.SHOP + shopId, verificationCodeDTO.getPhone(), verificationCodeDTO.getVerificationCode());
        PhoneVerificationResp phoneVerificationResp = allinpayMemberService.unbindPhone(unbindPhone);
        if (Objects.equals(Constant.ERROR, phoneVerificationResp.getResult())) {
            throw new YamiShopBindException("解绑手机失败");
        }
        // 更新绑定手机号码状态
        shopDetailMapper.updateShopBindPhone(shopId, 0);
    }

    @Override
    public SetCompanyInfoResp setCompanyInfo(Long shopId, String backUrl, SetCompanyInfoDTO setCompanyInfoDTO) {
        SetCompanyInfoResp setCompanyInfoResp = new SetCompanyInfoResp();
        CompanyBasicInfo companyBasicInfo = new CompanyBasicInfo();
        try {
            OpenClient client = allinpayConfig.getClient();
            BeanUtils.copyProperties(setCompanyInfoDTO, companyBasicInfo);
            companyBasicInfo.setLegalIds(client.encrypt(companyBasicInfo.getLegalIds()));
            companyBasicInfo.setAccountNo(client.encrypt(companyBasicInfo.getAccountNo()));
        } catch (YamiShopBindException e) {
            setCompanyInfoResp.setResult(AuditStatus.FAIL.getCode());
            setCompanyInfoResp.setFailReason(e.getMessage());
            return setCompanyInfoResp;
        }
        companyBasicInfo.setAuthType(2);
        companyBasicInfo.setIdentityType(1);
        SetCompanyInfo setCompanyInfo = new SetCompanyInfo(AllinpayConstant.SHOP + shopId, backUrl, companyBasicInfo);
        return allinpayMemberService.setCompanyInfo(setCompanyInfo);
    }

    @Override
    public UpdateCompanyInfoResp updateCompanyInfo(Long shopId, String backUrl, UpdateCompanyInfoDTO updateCompanyInfoDTO) {
        // 会员要通过审核
        CompanyInfo companyInfo = getCompanyInfo(AllinpayConstant.SHOP + shopId);
        if (Objects.isNull(companyInfo) || !Objects.equals(companyInfo.getStatus(), AuditStatus.SUCCESS.getCode())) {
            UpdateCompanyInfoResp updateCompanyInfoResp = new UpdateCompanyInfoResp();
            updateCompanyInfoResp.setResult(AuditStatus.FAIL.getCode());
            updateCompanyInfoResp.setFailReason("企业会员尚未通过审核，无法修改信息");
            return updateCompanyInfoResp;
        }
        UpdateCompanyInfo updateCompanyInfo = new UpdateCompanyInfo();
        BeanUtils.copyProperties(updateCompanyInfoDTO, updateCompanyInfo);
        updateCompanyInfo.setReqsn(String.valueOf(segmentService.getSegmentId(SegmentIdKey.UPDATE_COMPANT_SN)));
        updateCompanyInfo.setBackUrl(backUrl);
        updateCompanyInfo.setBizUserId(AllinpayConstant.SHOP + shopId);
        updateCompanyInfo.setIdentityType(IdentityType.ID_CARD.value());
        if (Objects.nonNull(updateCompanyInfoDTO.getLegalIds()) && StrUtil.isNotBlank(updateCompanyInfoDTO.getLegalIds())) {
            OpenClient client = allinpayConfig.getClient();
            updateCompanyInfo.setLegalIds(client.encrypt(updateCompanyInfoDTO.getLegalIds()));
        }
        return allinpayMemberService.updateCompanyInfo(updateCompanyInfo);
    }

    @Override
    public IdCardCollectResp idCardCollect(IdCardCollectDTO idCardCollectDTO, String backUrl) {
        IdCardCollect idCardCollect = new IdCardCollect();
        BeanUtils.copyProperties(idCardCollectDTO, idCardCollect);
        idCardCollect.setOcrComparisonResultBackUrl(backUrl);
        return allinpayMemberService.idCardCollect(idCardCollect);
    }

    @Override
    public IdCardCollectByFileUploadResp idcardCollectByFileUpload(IdCardCollectByFileUpload idCardCollectByFileUpload) {
        return allinpayMemberService.idcardCollectByFileUpload(idCardCollectByFileUpload);
    }

    @Override
    public CardBinInfo getBankCardBin(String cardNo) {
        GetBankCardBin getBankCardBin = new GetBankCardBin();
        OpenClient client = allinpayConfig.getClient();
        getBankCardBin.setCardNo(client.encrypt(cardNo));
        return allinpayMemberService.getBankCardBin(getBankCardBin);
    }

    @Override
    public void applyBindBankCard(Long shopId, ApplyBankCardDTO applyBankCardDTO, String legalName) {
        // 最多只能绑定一张法人账户
        checkLegalCard(shopId);
        OpenClient client = allinpayConfig.getClient();
        ApplyBindBankCard applyBindBankCard = new ApplyBindBankCard();
        BeanUtils.copyProperties(applyBankCardDTO, applyBindBankCard);
        applyBindBankCard.setName(legalName);
        applyBindBankCard.setBizUserId(AllinpayConstant.SHOP + shopId);
        applyBindBankCard.setCardCheck(8);
        applyBindBankCard.setIdentityType(IdentityType.ID_CARD.value());
        applyBindBankCard.setIdentityNo(client.encrypt(applyBankCardDTO.getIdentityNo()));
        applyBindBankCard.setCardNo(client.encrypt(applyBankCardDTO.getCardNo()));
        ApplyBindBankCardResp applyBindBankCardResp = allinpayMemberService.applyBindBankCard(applyBindBankCard);
        saveBankToDb(getShopBankCard(applyBindBankCardResp, legalName), shopId);
    }

    private void checkLegalCard(Long shopId) {
        List<BindCard> bindCards = queryBankCard(shopId, null);
        long bindCount = bindCards.stream().filter(card -> Objects.equals(card.getBankCardPro(), 0) && Objects.equals(card.getBindState(), 1)).count();
        if (bindCount == 1) {
            // 当前已绑定一张法人银行卡，无法继续绑定
            throw new YamiShopBindException("yami.allinpay.legal.bank.card");
        }
    }

    @Override
    public void bindBankCard(Long shopId, BindBankCardDTO bindBankCardDTO, String legalName) {
        // 目前采用四要素绑卡，不需要调用这个方法
        // 最多只能绑定一张法人账户
        checkLegalCard(shopId);
        BindBankCard bindBankCard = new BindBankCard();
        BeanUtils.copyProperties(bindBankCardDTO, bindBankCard);
        bindBankCard.setBizUserId(AllinpayConstant.SHOP + shopId);
        allinpayMemberService.bindBankCard(bindBankCard);
    }

    private ShopBankCardVO getShopBankCard(ApplyBindBankCardResp bindBankCardResp, String legalName) {
        List<BindCard> bindCardList = queryBankCard(Long.valueOf(bindBankCardResp.getBizUserId().substring(AllinpayConstant.SHOP_LENGTH)), null);
        List<BindCard> cardList = bindCardList.stream().filter(card -> Objects.equals(card.getBankCardPro(), 0) && Objects.equals(card.getBindState(), 1)).toList();
        BindCard bindCard = cardList.get(0);
        ShopBankCardVO shopBankCardVO = new ShopBankCardVO();
        shopBankCardVO.setBankName(bindCard.getBankName());
        shopBankCardVO.setCardNo(bindCard.getBankCardNo());
        shopBankCardVO.setRecipientName(legalName);
        shopBankCardVO.setOpeningBank(bindCard.getBankName());
        shopBankCardVO.setUnionBank(bindCard.getUnionBank());
        shopBankCardVO.setBankCardNo(bindCard.getBankCardNo());
        shopBankCardVO.setBankCardPro(0);
        return shopBankCardVO;
    }

    @Override
    public void unbindBankCard(Long shopId, UnbindBankCardDTO unbindBankCardDTO) {
        if (Objects.isNull(unbindBankCardDTO.getShopBankCardId())) {
            throw new YamiShopBindException("shopBankCardId Not Null");
        }
        List<BindCard> bindCards = queryBankCard(shopId, unbindBankCardDTO.getCardNo());
        if (CollUtil.isEmpty(bindCards)) {
            // 前银行卡不存在或未绑定
            throw new YamiShopBindException("yami.allinpay.bank.card.tip");
        }
        if (!Objects.equals(bindCards.get(0).getBankCardPro(), 0)) {
            // 只有法人银行卡才能解绑
            throw new YamiShopBindException("yami.allinpay.only.legal.bank.card.tip");
        }
        ShopBankCard shopBankCard = shopBankCardMapper.selectById(unbindBankCardDTO.getShopBankCardId());
        if (Objects.nonNull(shopBankCard) && Objects.equals(shopBankCard.getBankCardPro(), 1)) {
            // 企业对公户不支持解绑
            throw new YamiShopBindException("yami.allinpay.company.bank.card.tip");
        }
        shopBankCardMapper.deleteById(unbindBankCardDTO.getShopBankCardId());
        OpenClient client = allinpayConfig.getClient();
        UnbindBankCard unbindBankCard = new UnbindBankCard();
        unbindBankCard.setBizUserId(AllinpayConstant.SHOP + shopId);
        unbindBankCard.setCardNo(client.encrypt(unbindBankCardDTO.getCardNo()));
        allinpayMemberService.unbindBankCard(unbindBankCard);
    }

    @Override
    public List<BindCard> queryBankCard(Long shopId, String cardNo) {
        QueryBankCard queryBankCard = new QueryBankCard(AllinpayConstant.SHOP + shopId);
        if (cardNo != null) {
            OpenClient client = allinpayConfig.getClient();
            queryBankCard.setCardNo(client.encrypt(cardNo));
        }
        return allinpayMemberService.queryBankCard(queryBankCard);
    }

    @Override
    public void bindCompanyAccount(Long shopId, BindCompanyAccountDTO bindCompanyAccountDTO, String companyName) {
        List<BindCard> bindCards = allinpayMemberService.queryBankCard(new QueryBankCard(AllinpayConstant.SHOP + shopId));
        if (CollUtil.isNotEmpty(bindCards)) {
            long bindCount = bindCards.stream().filter(card -> Objects.equals(card.getBankCardPro(), 1) && Objects.equals(card.getBindState(), 1)).count();
            if (bindCount >= Constant.MAX_COMPANY_CARD_NUM) {
                // 当前绑定对公户账户已超过10张，无法继续绑定
                throw new YamiShopBindException("yami.allinpay.company.bank.card");
            }
        }
        BindCompanyAccount bindCompanyAccount = new BindCompanyAccount();
        BeanUtils.copyProperties(bindCompanyAccountDTO, bindCompanyAccount);
        OpenClient client = allinpayConfig.getClient();
        bindCompanyAccount.setAccountNo(client.encrypt(bindCompanyAccountDTO.getAccountNo()));
        bindCompanyAccount.setBizUserId(AllinpayConstant.SHOP + shopId);
        allinpayMemberService.bindCompanyAccount(bindCompanyAccount);
        // 保存到数据库
        saveBankToDb(getShopBankCardVO(bindCompanyAccountDTO, companyName), shopId);
    }

    private void saveBankToDb(ShopBankCardVO shopBankCardVO, Long shopId) {
        ShopBankCard shopBankCard = new ShopBankCard();
        BeanUtils.copyProperties(shopBankCardVO, shopBankCard);
        shopBankCard.setShopId(shopId);
        shopBankCard.setStatus(StatusEnum.ENABLE.value());
        shopBankCardMapper.insert(shopBankCard);
    }

    private static ShopBankCardVO getShopBankCardVO(BindCompanyAccountDTO bindCompanyAccountDTO, String companyName) {
        ShopBankCardVO shopBankCardVO = new ShopBankCardVO();
        shopBankCardVO.setBankName(bindCompanyAccountDTO.getParentBankName());
        shopBankCardVO.setRecipientName(companyName);
        shopBankCardVO.setCardNo(bindCompanyAccountDTO.getAccountNo());
        shopBankCardVO.setOpeningBank(bindCompanyAccountDTO.getParentBankName());
        shopBankCardVO.setUnionBank(bindCompanyAccountDTO.getUnionBank());
        shopBankCardVO.setBankCardNo(bindCompanyAccountDTO.getAccountNo());
        shopBankCardVO.setBankCardPro(1);
        return shopBankCardVO;
    }

    @Override
    public void deleteCache(Long shopId) {
        RedisUtil.del(CacheNames.COMPANY_INFO + CacheNames.UNION + AllinpayConstant.SHOP + shopId);
    }

    @Override
    public String signAcctProtocol(Long shopId, String backUrl, SignAcctProtocolDTO signAcctProtocolDTO) {
        if (Objects.isNull(signAcctProtocolDTO.getJumpUrl()) || Objects.isNull(signAcctProtocolDTO.getNoContractUrl())) {
            // 跳转地址不能为空
            throw new YamiShopBindException("yami.allinpay.jump.url");
        }
        // 企业会员账户提现协议签约前须完成设置企业信息，且企业信息审核成功。
        CompanyInfo companyInfo = getCompanyInfo(AllinpayConstant.SHOP + shopId);
        if (Objects.isNull(companyInfo) || !Objects.equals(companyInfo.getStatus(), AuditStatus.SUCCESS.getCode())) {
            // 企业会员尚未通过审核，无法进行签约
            throw new YamiShopBindException("yami.allinpay.cannot.sign.audit");
        }
        if (Objects.isNull(companyInfo.getPhone())) {
            // 尚未绑定手机号码，无法进行签约
            throw new YamiShopBindException("yami.allinpay.cannot.sign.phone");
        }
        if (Objects.equals(signAcctProtocolDTO.getSignAcctType(), SignAcctType.LEGAL_PERSON.getValue())) {
            //  个人会员账户提现协议签约前须绑定银行卡成功。
            List<BindCard> bindCards = queryBankCard(shopId, null);
            long bindCount = bindCards.stream().filter(card -> Objects.equals(card.getBankCardPro(), 0) && Objects.equals(card.getBindState(), 1)).count();
            if (bindCount < 1) {
                // 当前未绑定法人银行卡，请进行绑定
                throw new YamiShopBindException("yami.allinpay.not.bind.legal.bank.card");
            }
        }
        SignAcctProtocol signAcctProtocol = new SignAcctProtocol();
        BeanUtils.copyProperties(signAcctProtocolDTO, signAcctProtocol);
        OpenClient client = allinpayConfig.getClient();
        String needEncrypt = "#";
        if (signAcctProtocolDTO.getNoContractUrl().contains(needEncrypt)) {
            signAcctProtocol.setNoContractUrl(client.encrypt(signAcctProtocolDTO.getNoContractUrl()));
        }
        signAcctProtocol.setSignAcctName(Objects.equals(signAcctProtocolDTO.getSignAcctType(), 2) ? companyInfo.getLegalName() : companyInfo.getCompanyName());
        signAcctProtocol.setBizUserId(AllinpayConstant.SHOP + shopId);
        signAcctProtocol.setBackUrl(backUrl);
        signAcctProtocol.setSource(VisitSourceType.PC.value());
        return allinpayMemberService.signAcctProtocol(signAcctProtocol);
    }

    @Override
    public String signContractQuery(Long shopId, SignAcctProtocolDTO signAcctProtocolDTO) {
        SignContractQuery signContractQuery = new SignContractQuery();
        BeanUtils.copyProperties(signAcctProtocolDTO, signContractQuery);
        signContractQuery.setBizUserId(AllinpayConstant.SHOP + shopId);
        signContractQuery.setSource(VisitSourceType.PC.value());
        return allinpayMemberService.signContractQuery(signContractQuery);
    }

    @Override
    public Integer getIdCardStatus(Integer ocrRegnumComparisonResult, Integer ocrIdcardComparisonResult) {
        if (Objects.isNull(ocrRegnumComparisonResult) && Objects.isNull(ocrIdcardComparisonResult)) {
            return IdCardCollectProcessStatus.UN_COMMITTED.value();
        }
        boolean companySuccess = Objects.equals(ocrRegnumComparisonResult, 1);
        boolean idCardSuccess = Objects.equals(ocrIdcardComparisonResult, 1);
        Integer status;
        if (companySuccess && idCardSuccess) {
            status = IdCardCollectProcessStatus.ALL.value();
        } else if (!companySuccess && !idCardSuccess) {
            status = IdCardCollectProcessStatus.WAIT_AUDIT.value();
        } else if (companySuccess) {
            status = IdCardCollectProcessStatus.REG.value();
        } else {
            status = IdCardCollectProcessStatus.ID_CARD.value();
        }
        return status;
    }

    @Override
    public boolean getIsAllinpay() {
        String paySettlementConfigStr = sysConfigService.getValue(Constant.PAY_SETTLEMENT_CONFIG);
        PaySettlementConfig paySettlementConfig = Json.parseObject(paySettlementConfigStr, PaySettlementConfig.class);
        Integer paySettlementType = paySettlementConfig.getPaySettlementType();
        return Objects.equals(paySettlementType, 1);
    }

    @Override
    public void createAllinpayCompanyMember(Long shopId) {
        if (getIsAllinpay()) {
            createCompanyMember(AllinpayConstant.SHOP + shopId);
            // 更新店铺为已创建会员
            shopDetailMapper.updateShopIsCreate(Collections.singletonList(shopId));
        }
    }

    @Override
    public IdCardCollectByFileUploadResp idCardCollectByFileUpload(String legalPicFaceToken, String legalPicEmblemToken, Integer picType, String token, String bizUserId) {
        IdCardCollectByFileUploadResp idCardCollectByFileUploadResp = new IdCardCollectByFileUploadResp();
        IdCardCollectByFileUpload idCardCollectByFileUpload = new IdCardCollectByFileUpload();
        idCardCollectByFileUpload.setBizUserId(bizUserId);
        idCardCollectByFileUpload.setReqSerialNo(String.valueOf(segmentService.getSegmentId(SegmentIdKey.ALLINPAY_FILE_UPLOAD, 15)));
        String domainUrl = shopConfig.getDomain().getApiDomainName();
        idCardCollectByFileUpload.setOcrComparisonResultBackUrl(domainUrl + AllinpayNoticeUrl.ID_CARD_COLLECT);
        if (StrUtil.isNotBlank(legalPicFaceToken)) {
            if (StrUtil.isBlank(legalPicEmblemToken)) {
                throw new YamiShopBindException("身份证提交需要同时提供国徽面和人像面！");
            }
            try {
                legalPicFaceToken = allinpayConfig.uploadFile(legalPicFaceToken);
            } catch (Exception e) {
                logger.info("通联上传图片失败{}", e.getMessage());
                idCardCollectByFileUploadResp.setResult(2);
                return idCardCollectByFileUploadResp;
            }
            idCardCollectByFileUpload.setLegalPicFaceToken(legalPicFaceToken);
        }
        if (StrUtil.isNotBlank(legalPicEmblemToken)) {
            // 避免请求过于频繁
            try {
                Thread.sleep(700);
            } catch (InterruptedException e) {
                logger.error("InterruptedException", e);
            }
            try {
                legalPicEmblemToken = allinpayConfig.uploadFile(legalPicEmblemToken);
            } catch (Exception e) {
                logger.info("通联上传图片失败{}", e.getMessage());
                idCardCollectByFileUploadResp.setResult(2);
                return idCardCollectByFileUploadResp;
            }
            idCardCollectByFileUpload.setLegalPicEmblemToken(legalPicEmblemToken);
        }
        if (Objects.equals(picType, PicType.BUSINESS_LICENSE.getCode()) && StrUtil.isNotBlank(token)) {
            idCardCollectByFileUpload.setPicType(picType);
            try {
                token = allinpayConfig.uploadFile(token);
            } catch (Exception e) {
                logger.info("通联上传图片失败{}", e.getMessage());
                idCardCollectByFileUploadResp.setResult(2);
                return idCardCollectByFileUploadResp;
            }
            idCardCollectByFileUpload.setToken(token);
        }
        return idcardCollectByFileUpload(idCardCollectByFileUpload);
    }
}
